Many techniques for supporting network processing are known. Such techniques include generic memory management, interrupt scheduling, state machines, computer program code generation, and multi-protocol interfaces. The foundations of such processes are generally understood but in many cases their practical realization has fallen short of their potential.
A number of computer programs may be implemented as state machines. For example, a simple router state machine may be designed to route packets of information. The state machine may include a repetitious activity such as receiving a packet, identifying the destination address by performing a lookup, and forwarding the packet. Here the computer program is a potential candidate to be implemented as state machine.
A state machine exists in one state at a given time, and may transition to another state taking inputs into account. The state machine typically includes a finite number of states, a finite number of transitions, and a current state. A state machine is typically processed by evaluating the current state, inputs, potential transitions and corresponding guard conditions that may limit transitions. A simple router state machine may include three states: ready state, address state, and forward state. Receiving a packet while in the ready state may cause a transition to the address state. The destination address may be determined while in the address state, followed by a transition to the forward state. The forward state may then forward the received packet based on the identified address. After the packet is forwarded the state machine may transition back to the ready state to wait for another packet. The state machine may thereby provide an implementation of the computer program to receive a packet of information, identify the destination address and to forward the packet.
Typically a set of state machines may be generated to perform similar activities. Each individual state machine in the set of state machines may be scheduled for execution on a single computer processor. As an example, the previously described simple router state machine may be duplicated five times with each of the five state machines executing as five separate threads coupled with a single computer processor. The single computer processor typically performs context switching to execute each of these five threads. This context switching takes a considerable amount of processing resources. Unfortunately, conventional processing of operating system threads includes context switching between each thread without considering attributes and/or states associated with the thread.
Therefore conventional processing of is not efficient and there remains a need for a system, method, computer program, and computer program product for processing state machines that reduces the context switching problem. What is needed is an ability to overcomes the above and other disadvantages of known network processors.